//
//  MainPublickTools.h
//  BuxProject
//
//  Created by zxh on 2022/3/9.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef enum : NSUInteger {
    GradientTypeTopToBottom = 0,//从上到下
    GradientTypeLeftToRight = 1,//从左到右
    GradientTypeUpleftToLowright = 2,//左上到右下
    GradientTypeUprightToLowleft = 3,//右上到左下
} GradientType;
/**
 常用方法判断
 */
@interface MainPublickTools : NSObject

///手机号码长度判断，是否是11位
+ (BOOL) phoneNumLength:(NSString *)str;
///时间准换为时间戳
+ (NSString *)obtainNowtimestamp:(double)time;
///时间转时间字符串
+ (NSString *)DateTransformationmate:(NSString *)timeformate timeString:(NSString *)timestr;
/// rootViewController中上面ViewController
+(UIViewController *)obtaincurrentController;
/// - get时间戳秒级
+ (NSString *)obtainNowlongtimestamp;

///判断是否全是空格
+ (BOOL) wholeSpace:(NSString *) content;

///时间戳转时间 typeStr 类型yyyy-MM-dd HH:mm:ss  yyyy-MM-dd MM-dd
+ (NSString *)timestamptransformTimeType:(NSString *)timestamp timeShowType:(NSString *)typeStr;

/// to Json
+(NSString *)objectChangeJsonWithObj:(id)object;

///时间戳转时间 typeStr 类型yyyy-MM-dd HH:mm:ss  yyyy-MM-dd MM-dd
+ (NSString *)starChangeToTime:(NSString *)timeStr showType:(NSString *)typeStr;
///时间戳转时间后根据截止时间计算倒计时
+ (NSString *)obtainNowtimestamp:(double)endTimestamp timeShowType:(NSString *)showType;
///当前时间
+(NSString*)getNowwsTime;
///转Json
+(NSString *)transformToJsonWithObj:(id)object;
///根据文字内容获取宽度
+(CGFloat)getContentWidthWidthTextStr:(NSString *)textStr andTextFont:(UIFont *)textFont;
+(CGFloat)getHeightTextString:(NSString *)textStr andTextFont:(UIFont *)textFont andWidth:(float)width;

///获取添加Style的高度
+(CGFloat)getHeightTextString:(NSString *)textStr withTextFont:(UIFont *)textFont withWidth:(float)width withStyle:(NSMutableParagraphStyle *)style;

/** 将字典转换成json格式字符串,不含\n这些符号*/
+ (NSData *)changeFormatDataForDictionary:(NSDictionary *)dicJson;
/** 时间字符串转Date时间*/
+(NSDate *)dateFromString:(NSString *)timeStr withDateType:(NSString *)type;
//获取当前时间
+ (NSString *)getCurrentTime;
/** 金币转换*/
+ (NSString *)toolsUnitConversiongMet:(NSString *)money;

/**json转Dic*/
+ (NSDictionary *)getDictWithJSON:(NSString *)jsonString;

/**json 转数组*/
+ (NSArray *)stringToJSON:(NSString *)jsonStr;
/*!
 *时间转时间戳
 */
+ (NSString *)transformTimeToTSWithStr:(NSString *)time;
///是否是null
+(BOOL)ObjectIsNull:(NSObject *)obj;

///是否是同一天
+ (BOOL)isidenticalTwoD:(NSString *)age;

+(NSString *)StringIsSafe:(NSString *)contentStr;
///机型
+ (NSString *)obtainDeviceNameWithString:(NSString *)deviceName;
///判断是否是空的字符串并转为正确的字符串


+ (NSData*)obtainPhotoData:(UIImage*)image;

+ (NSString *)transformToPinyin:(NSString *)aString isQuanPin:(BOOL)quanPin;
///文字内容，长度
+ (void)textFieldEditingChanged:(UITextField *)textField withLength:(NSInteger)maxLength;

/// colors 渐变颜色数组
/// gradientType 渐变样式
/// imgSize 图片大小
/// 颜色->图片
+ (UIImage *)gradientColorImageFromColors:(NSArray*)colors gradientType:(GradientType)gradientType imgSize:(CGSize)imgSize;

//上级父类
+ (UIViewController *)findSuperViewController:(UIView *)sourceView;
@end

NS_ASSUME_NONNULL_END
